package realQuestion.dewu10_10_anzhuo;

import java.util.Scanner;

public class Main1 {

    public static void main(String[] args) {

        Scanner scanner = new Scanner(System.in);
        int n = scanner.nextInt();
        int x = scanner.nextInt();
         char[]  cheems=new char[n];
        String next = scanner.next();
       cheems = next.toCharArray();
        boolean b = find(cheems, x);
        if (b==true){
            System.out.println(1);
        }else {
            System.out.println(0);
        }

    }
    public static  boolean find(char[] cheems,int x){
        boolean ans=false;
        int length = cheems.length;
        if (x>length){
            return ans;
        }
        for (int i = 0; i <= cheems.length-x; i++) {
            if (judge(cheems,i,i+x-1)==true){
                ans=true;
                break;
            }
        }

        return  ans;
    }
    public  static boolean judge(char[] cheems,int left,int right){
        boolean ans=true;
        while (left<=right){
            if (cheems[left]== cheems[right]){
                left++;
                right--;
            }else {
                ans=false;
                break;
            }
        }

        return  ans;
    }







}
